package thread;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.*;

public class ThreadTest {


    Set<String> set  = Collections.synchronizedSet(new HashSet<>());
    public static void main(String[] args) {
        //单线程池
        Executors.newSingleThreadExecutor().execute(()->{
            System.out.println("。。。。。");
        });
        //定长线程池
        Executors.newFixedThreadPool(10).submit(()->{
            System.out.println();
        });
        //可缓存线程池
        Executors.newCachedThreadPool();
        //周期线程池
        Executors.newScheduledThreadPool(10);

        //使用ThreadPoolExecutor
        new ThreadPoolExecutor(10, 19,
                0L, TimeUnit.MILLISECONDS,
                new LinkedBlockingQueue<Runnable>());

    }
}
class ThreadTest1 extends Thread{
    @Override
    public void run() {
        super.run();
    }
}

class ThreadTest2 implements Runnable{
    @Override
    public void run() {
    }
}
class ThreadTest3 implements Callable {
    @Override
    public Object call() throws Exception {
        return null;
    }
}

